import numpy as np
import cv2
from scipy import ndimage
import skimage.color
from helper import briefMatch
from helper import computeBrief
from helper import fast_corner_detection


def matchPics(I1, I2):
    img1 = cv2.cvtColor(I1, cv2.COLOR_RGB2GRAY)
    img2 = cv2.cvtColor(I2, cv2.COLOR_RGB2GRAY)
    locs1 = fast_corner_detection(img1)
    locs2 = fast_corner_detection(img2)
    res = computeBrief(img1, locs1)
    desc1 = res[0]
    locs1 = res[1]
    res1 = computeBrief(img2, locs2)
    desc2 = res1[0]
    locs2 = res1[1]
    matches = briefMatch(desc1, desc2)
    print(matches)
    return matches, locs1, locs2
